.class public Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;
.super Ljava/lang/Object;
.source "MeasureInfoCard.java"


# instance fields
.field private areaInfo:Landroid/widget/LinearLayout;

.field private areaUnit:Landroid/widget/TextView;

.field private areaValue:Landroid/widget/TextView;

.field private ctx:Landroid/content/Context;

.field private fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

.field private idInfo:Landroid/widget/RelativeLayout;

.field private measureGroup:Landroid/widget/TextView;

.field private measureId:Landroid/widget/TextView;

.field private measureName:Landroid/widget/TextView;

.field measureid:I

.field private unit1:Landroid/widget/TextView;

.field private unit1Label:Landroid/widget/TextView;

.field private unit1Value:Landroid/widget/TextView;

.field private view:Landroid/view/View;


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/view/View;Llt/noframe/gpsfarmguide/models/MeasuringModel;)V
    .locals 2

    .line 51
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 49
    iput v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureid:I

    .line 52
    iput-object p1, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->ctx:Landroid/content/Context;

    .line 53
    iput-object p2, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    .line 54
    new-instance p2, Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    invoke-direct {p2, p1}, Llt/noframe/gpsfarmguide/analytics/FireAnalytics;-><init>(Landroid/content/Context;)V

    iput-object p2, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    .line 55
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getId()I

    move-result p2

    iput p2, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureid:I

    .line 56
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->ini()V

    .line 57
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getName()Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p0, p2}, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->setMeasureName(Ljava/lang/String;)V

    .line 58
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getGroup()I

    move-result p2

    invoke-virtual {p0, p2}, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->setMeasureGroup(I)V

    .line 59
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getUniqueId()Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p0, p2}, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->setMeasureId(Ljava/lang/String;)V

    .line 60
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getMeasuringType()I

    move-result p2

    const/4 v0, 0x1

    if-ne p2, v0, :cond_0

    .line 61
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/AbstractMeasuringModel;->getPoints()Ljava/util/List;

    move-result-object p2

    invoke-static {p2}, Llt/noframe/gpsfarmguide/utils/Mathematics;->calculateDistance(Ljava/util/List;)D

    move-result-wide p2

    invoke-static {p1}, Llt/noframe/gpsfarmguide/utils/Preferences;->getDistanceUnit(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p1

    invoke-static {p2, p3, p1}, Llt/noframe/gpsfarmguide/utils/Mathematics;->convertDistance(DLjava/lang/String;)D

    move-result-wide p1

    invoke-static {p1, p2}, Llt/noframe/gpsfarmguide/utils/Utils;->smartRounding(D)D

    move-result-wide p1

    invoke-virtual {p0, p1, p2}, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->setDistance(D)V

    goto :goto_0

    .line 62
    :cond_0
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getMeasuringType()I

    move-result p2

    const/4 v0, 0x2

    if-ne p2, v0, :cond_1

    .line 63
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/AbstractMeasuringModel;->getPoints()Ljava/util/List;

    move-result-object p2

    invoke-static {p2}, Llt/noframe/gpsfarmguide/utils/Mathematics;->calculatePerimeter(Ljava/util/List;)D

    move-result-wide v0

    invoke-static {p1}, Llt/noframe/gpsfarmguide/utils/Preferences;->getDistanceUnit(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p2

    invoke-static {v0, v1, p2}, Llt/noframe/gpsfarmguide/utils/Mathematics;->convertDistance(DLjava/lang/String;)D

    move-result-wide v0

    invoke-static {v0, v1}, Llt/noframe/gpsfarmguide/utils/Utils;->smartRounding(D)D

    move-result-wide v0

    invoke-virtual {p0, v0, v1}, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->setPerimeter(D)V

    .line 64
    invoke-virtual {p3}, Llt/noframe/gpsfarmguide/models/AbstractMeasuringModel;->getPoints()Ljava/util/List;

    move-result-object p2

    invoke-static {p2}, Llt/noframe/gpsfarmguide/utils/Mathematics;->calculateArea(Ljava/util/List;)D

    move-result-wide p2

    invoke-static {p1}, Llt/noframe/gpsfarmguide/utils/Preferences;->getAreaUnit(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p1

    invoke-static {p2, p3, p1}, Llt/noframe/gpsfarmguide/utils/Mathematics;->convertArea(DLjava/lang/String;)D

    move-result-wide p1

    invoke-static {p1, p2}, Llt/noframe/gpsfarmguide/utils/Utils;->smartRounding(D)D

    move-result-wide p1

    invoke-virtual {p0, p1, p2}, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->setArea(D)V

    :cond_1
    :goto_0
    return-void
.end method

.method static synthetic access$000(Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;)Llt/noframe/gpsfarmguide/analytics/FireAnalytics;
    .locals 0

    .line 29
    iget-object p0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    return-object p0
.end method


# virtual methods
.method public getView()Landroid/view/View;
    .locals 1

    .line 173
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    return-object v0
.end method

.method public ini()V
    .locals 3

    .line 72
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f090173

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureName:Landroid/widget/TextView;

    .line 74
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f09027c

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1Label:Landroid/widget/TextView;

    .line 75
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f09027d

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1Value:Landroid/widget/TextView;

    .line 76
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f09027a

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1:Landroid/widget/TextView;

    .line 78
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f09027f

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/LinearLayout;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->areaInfo:Landroid/widget/LinearLayout;

    .line 79
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f090281

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->areaValue:Landroid/widget/TextView;

    .line 80
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f09027e

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->areaUnit:Landroid/widget/TextView;

    .line 82
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f090170

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureGroup:Landroid/widget/TextView;

    .line 84
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f090172

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureId:Landroid/widget/TextView;

    .line 85
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f090130

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/RelativeLayout;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->idInfo:Landroid/widget/RelativeLayout;

    .line 88
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f090269

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageButton;

    .line 89
    new-instance v1, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard$1;

    invoke-direct {v1, p0}, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard$1;-><init>(Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;)V

    invoke-virtual {v0, v1}, Landroid/widget/ImageButton;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 98
    new-instance v1, Llt/noframe/gpsfarmguide/database/DbTracks;

    invoke-direct {v1}, Llt/noframe/gpsfarmguide/database/DbTracks;-><init>()V

    iget v2, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureid:I

    invoke-virtual {v1, v2}, Llt/noframe/gpsfarmguide/database/DbTracks;->getTracksCount(I)I

    move-result v1

    const/4 v2, 0x1

    if-ge v1, v2, :cond_0

    const/16 v1, 0x8

    goto :goto_0

    :cond_0
    const/4 v1, 0x0

    :goto_0
    invoke-virtual {v0, v1}, Landroid/widget/ImageButton;->setVisibility(I)V

    return-void
.end method

.method public remove()V
    .locals 4

    .line 165
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->view:Landroid/view/View;

    const v1, 0x7f09016f

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    if-eqz v0, :cond_0

    .line 167
    iget-object v2, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->ctx:Landroid/content/Context;

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    const/16 v3, 0xc8

    invoke-static {v2, v1, v3}, Llt/noframe/gpsfarmguide/utils/Animations;->topUpTrans(Landroid/content/Context;Landroid/view/View;I)V

    .line 168
    invoke-virtual {v0}, Landroid/view/View;->getParent()Landroid/view/ViewParent;

    move-result-object v1

    check-cast v1, Landroid/widget/FrameLayout;

    invoke-virtual {v1, v0}, Landroid/widget/FrameLayout;->removeView(Landroid/view/View;)V

    :cond_0
    return-void
.end method

.method public setArea(D)V
    .locals 2

    .line 156
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->areaInfo:Landroid/widget/LinearLayout;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/LinearLayout;->setVisibility(I)V

    .line 157
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->areaValue:Landroid/widget/TextView;

    invoke-static {p1, p2}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 158
    iget-object p1, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->areaUnit:Landroid/widget/TextView;

    iget-object p2, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->ctx:Landroid/content/Context;

    invoke-static {p2}, Llt/noframe/gpsfarmguide/utils/Preferences;->getAreaUnit(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p1, p2}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    return-void
.end method

.method public setDistance(D)V
    .locals 3

    .line 136
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1Label:Landroid/widget/TextView;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->ctx:Landroid/content/Context;

    const v2, 0x7f1100b1

    invoke-virtual {v1, v2}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 137
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1Value:Landroid/widget/TextView;

    invoke-static {p1, p2}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 138
    iget-object p1, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1:Landroid/widget/TextView;

    iget-object p2, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->ctx:Landroid/content/Context;

    invoke-static {p2}, Llt/noframe/gpsfarmguide/utils/Preferences;->getDistanceUnit(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p1, p2}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    return-void
.end method

.method public setMeasureGroup(I)V
    .locals 2

    .line 114
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureGroup:Landroid/widget/TextView;

    invoke-static {}, Llt/noframe/gpsfarmguide/database/DB;->getDB()Llt/noframe/gpsfarmguide/database/DB;

    move-result-object v1

    invoke-virtual {v1, p1}, Llt/noframe/gpsfarmguide/database/DB;->getGroupName(I)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    return-void
.end method

.method public setMeasureId(Ljava/lang/String;)V
    .locals 2

    .line 122
    invoke-static {p1}, Llt/noframe/gpsfarmguide/utils/Utils;->isEmpty(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 123
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->idInfo:Landroid/widget/RelativeLayout;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/RelativeLayout;->setVisibility(I)V

    .line 124
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureId:Landroid/widget/TextView;

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0

    .line 126
    :cond_0
    iget-object p1, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureId:Landroid/widget/TextView;

    const-string v0, ""

    invoke-virtual {p1, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 127
    iget-object p1, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->idInfo:Landroid/widget/RelativeLayout;

    const/16 v0, 0x8

    invoke-virtual {p1, v0}, Landroid/widget/RelativeLayout;->setVisibility(I)V

    :goto_0
    return-void
.end method

.method public setMeasureName(Ljava/lang/String;)V
    .locals 1

    .line 106
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->measureName:Landroid/widget/TextView;

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    return-void
.end method

.method public setPerimeter(D)V
    .locals 3

    .line 146
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1Label:Landroid/widget/TextView;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->ctx:Landroid/content/Context;

    const v2, 0x7f110181

    invoke-virtual {v1, v2}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 147
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1Value:Landroid/widget/TextView;

    invoke-static {p1, p2}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 148
    iget-object p1, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->unit1:Landroid/widget/TextView;

    iget-object p2, p0, Llt/noframe/gpsfarmguide/widgets/MeasureInfoCard;->ctx:Landroid/content/Context;

    invoke-static {p2}, Llt/noframe/gpsfarmguide/utils/Preferences;->getDistanceUnit(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p1, p2}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    return-void
.end method
